package com.test.service.impl;

import com.test.dao.IBuildMeterHistoricalDao;
import com.test.model.BuildMeterCurrentData;
import com.test.model.BuildMeterHistoricalData;
import com.test.service.IBuildMeterHistoricalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.SimpleFormatter;

/**
 * Created by ZZF on 2017/7/12.
 */
@Service
public class BuildMeterHistoricalServiceImpl implements IBuildMeterHistoricalService {


    @Autowired
    IBuildMeterHistoricalDao buildMeterHistoricalDao;

    @Override
    public void addHistorical(BuildMeterCurrentData buildMeterCurrentData) {


        if (buildMeterCurrentData!=null){
            BuildMeterHistoricalData buildMeterHistoricalData = new BuildMeterHistoricalData();

            buildMeterHistoricalData.setPlanTime(buildMeterCurrentData.getPlanTime());
            buildMeterHistoricalData.setBuildMeterId(buildMeterCurrentData.getBuildMeterId());
            buildMeterHistoricalData.setAccFlow(buildMeterCurrentData.getAccFlow());
            buildMeterHistoricalData.setAccHeat(buildMeterCurrentData.getAccHeat());
            buildMeterHistoricalData.setHeat(buildMeterCurrentData.getHeat());
            buildMeterHistoricalData.setFlow(buildMeterCurrentData.getFlow());
            buildMeterHistoricalData.setReturnTemperature(buildMeterCurrentData.getReturnTemperature());
            buildMeterHistoricalData.setSupplyTemperature(buildMeterCurrentData.getSupplyTemperature());
            buildMeterHistoricalDao.save(buildMeterHistoricalData);



        }






    }
}
